<%@ page contentType="text/html;charset=UTF-8"%>
<!doctype html>
<html>
<head>
<title>数据库监控</title>

<jsp:include flush="true" page="../../include.jsp"></jsp:include>
<script type="text/javascript">
$(function(){
	onLoad();
})

function onLoad(){
	$.getJSON('${home}/jsp/sys/pool.do', function(data) {
		var rows = $("#poolTable").datagrid('getRows');
		if(rows.length>0){
			//清除所有数据
			$('#poolTable').datagrid('loadData', {total:0,rows:[]});
		}
		$("#poolTable").datagrid('appendRow',{text:"numConnections",result:data.numConnections});
		$("#poolTable").datagrid('appendRow',{text:"numBusyConnections",result:data.numBusyConnections});
		$("#poolTable").datagrid('appendRow',{text:"numIdleConnections",result:data.numIdleConnections});
		$("#poolTable").datagrid('appendRow',{text:"numUserPools",result:data.numUserPools});
		/*
		var items = [];
		$.each(data, function(key, val) {
		items.push('<li id="' + key + '">' + val + '</li>');
		});
		$('<ul/>', {
		'class': 'my-new-list',
		html: items.join('')
		}).appendTo('body');*/
	});
}

	var toolbar = [{
		text:'刷新',
		iconCls:'icon-reload',
		handler:function(){
			onLoad();
		}
	},{
		text:'Cut',
		iconCls:'icon-cut',
		handler:function(){

		}
	},'-',{
		text:'Save',
		iconCls:'icon-save',
		handler:function(){alert('save')}
	}];
</script>		

<style type="text/css">
</style>
</head>
<body>
	<div style="margin:30px 20px;">
<!--  	
		<table id="poolTable" class="easyui-datagrid" title="连接池情况" style="width:400px;height:350px"
				data-options="iconCls: 'icon-edit',fitColumns:true,singleSelect:true,toolbar:toolbar">
			<thead>
				<tr>
					<th data-options="field:'text',width:200,resizable:true">参数名称</th>
					<th data-options="field:'result',width:100,resizable:true">值</th>
				</tr>
			</thead>
		</table>
-->		
	<table id="poolTable" class="easyui-datagrid" title="连接池情况" style="width:400px;height:250px"
			data-options="rownumbers:true,singleSelect:true,toolbar:toolbar">
		<thead>
			<tr>
					<th data-options="field:'text',width:200,resizable:true">参数名称</th>
					<th data-options="field:'result',width:100,resizable:true">值</th>
			</tr>
		</thead>
	</table>
	
	</div>
</body>
</html>